using IcsSEMCtrl.Util;
namespace Lifter.Global.Device
{
    public class ElevType
    {
        public const int _ELEV0 = 0;
        public const int _WIRE_H = 1;
        public const int _WIRE_N = 2;
        public const int _NORMAL = 3;
        private int _value;
        private static int _size;
        private static ElevType[] _array;
        public static string[] displayStrings;
        public static ElevType[] displayValues;
        public static ElevType ELEV0;
        public static ElevType WIRE_H;
        public static ElevType WIRE_N;
        public static ElevType NORMAL;
        public static ElevType IT_ENUM_MAX;
        static ElevType()
        {
            ElevType._size = 4;
            ElevType._array = new ElevType[ElevType._size];
            ElevType.displayStrings = new string[ElevType._size];
            ElevType.displayValues = new ElevType[ElevType._size];
            ElevType.ELEV0 = new ElevType(0);
            ElevType.WIRE_H = new ElevType(1);
            ElevType.WIRE_N = new ElevType(2);
            ElevType.NORMAL = new ElevType(3);
            ElevType.IT_ENUM_MAX = new ElevType(2147483647);
            ElevType.displayStrings[0] = "ELEV_0";
            ElevType.displayStrings[1] = "WIRE_H";
            ElevType.displayStrings[2] = "WIRE_N";
            ElevType.displayStrings[3] = "NORMAL";
            ElevType.displayValues[0] = ElevType.ELEV0;
            ElevType.displayValues[1] = ElevType.WIRE_H;
            ElevType.displayValues[2] = ElevType.WIRE_N;
            ElevType.displayValues[3] = ElevType.NORMAL;
        }
        public static string ValueToString(ElevType val)
        {
            string result;
            switch (val.Value())
            {
                case 0:
                    result = ElevType.displayStrings[0];
                    break;
                case 1:
                    result = ElevType.displayStrings[1];
                    break;
                case 2:
                    result = ElevType.displayStrings[2];
                    break;
                case 3:
                    result = ElevType.displayStrings[3];
                    break;
                default:
                    result = "";
                    break;
            }
            return result;
        }
        public static ElevType StringToValue(string val)
        {
            ElevType result;
            if (Helper.IsNullOrEmpty(val))
            {
                result = ElevType.IT_ENUM_MAX;
            }
            else
            {
                for (int i = 0; i < ElevType.displayStrings.Length; i++)
                {
                    if (val.Equals(ElevType.displayStrings[i]))
                    {
                        result = ElevType.displayValues[i];
                        return result;
                    }
                }
                result = null;
            }
            return result;
        }
        public int Value()
        {
            return this._value;
        }
        public static ElevType From_Int(int value)
        {
            ElevType result;
            if (value >= 0 && value < ElevType._size)
            {
                result = ElevType._array[value];
            }
            else
            {
                result = ElevType.IT_ENUM_MAX;
            }
            return result;
        }
        protected ElevType(int value)
        {
            this._value = value;
            if (value >= 0 && value < ElevType._size)
            {
                ElevType._array[this._value] = this;
            }
        }
        public bool Equals(ElevType otherEnum)
        {
            return otherEnum.Value() == this._value;
        }
        public override string ToString()
        {
            return ElevType.displayStrings[this._value];
        }
    }
}
